<div class="row-fluid" id="controller-Dynamic">
    <div class="span10">
        <h3 class="subsection">Dynamic</h3>

        <p>Dynamic is the most powerful constraint in Deadbolt.  It enforces arbitrary rules.  See the documentation for a full overview.</p>
        <p>In these examples, the action is shown on the left, the rule specified in the relevant DynamicResourceHandler is in the center and
            the result is in an iframe on the right.</p>
    </div>
</div>
<div class="row-fluid">
    <div class="span4 columnHeader">Specification</div>
    <div class="span4 columnHeader">Rule</div>
    <div class="span2 columnHeader">Result</div>
</div>

<div class="row-fluid">
    <div class="span4">
        <pre>
  def pureLuck = deadbolt.Dynamic(name = "pureLuck")() { authRequest =>
    Future {
      Ok(accessOk())
    }
  }</pre>
    </div>
    <div class="span4">
        <pre>
def isAllowed[A](name: String,
                 meta: Option[Any],
                 deadboltHandler: DeadboltHandler,
                 request: AuthenticatedRequest[A]): Future[Boolean] =
  Future(System.currentTimeMillis() % 2 == 0)</pre>
    </div>
    <div class="span2">
        <iframe src="@routes.DynamicRestrictionsController.pureLuck"></iframe>
    </div>
</div>
<div class="row-fluid">
    <div class="span4">
        <pre>
  def noWayJose = deadbolt.Dynamic(name = "pureLuck", handler = handlers(HandlerKeys.altHandler))() { authRequest =>
    Future {
      Ok(accessOk())
    }
  }</pre>
    </div>
    <div class="span4">
        <pre>
  def isAllowed[A](name: String,
                   meta: Option[Any],
                   deadboltHandler: DeadboltHandler,
                   request: AuthenticatedRequest[A]): Future[Boolean] = Future(false)</pre>
    </div>
    <div class="span2">
        <iframe src="@routes.DynamicRestrictionsController.noWayJose"></iframe>
    </div>
</div>
